package com.iss.card.view.mycard;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.iss.card.R;
import com.iss.card.common.ApplicationManager;
import com.iss.card.common.FunctionUtil;

public class MyCardFragment extends Fragment{
	
	private MyCardView myCardView;
	
	private FragmentActivity mContext;
	
    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        mContext = (FragmentActivity)activity;
    }
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		View view = inflater.inflate(R.layout.frame_card_list_view, null);
		if(FunctionUtil.isUserLogIn()){
			myCardView = new MyCardView(mContext, view);
			return view;
		}else {
			return null;
		}

	}

	@Override
	public void onResume() {
		super.onResume();
	}

	@Override
	public void onHiddenChanged(boolean hidden) {
		// TODO Auto-generated method stub
		super.onHiddenChanged(hidden);
		if(FunctionUtil.isUserLogIn()){
			myCardView.initView();
			myCardView.doAsyncService();  
		}
	}
	
}
